<%@ page language="java" import="java.util.*" pageEncoding="utf-8"%>
<%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c" %>
<%
String path = request.getContextPath();
%>

<!--   学校信息设置 修改 -->
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
  <head>
	<title> 学校信息设置</title>
	<link href="<%=path %>/css/index_css.css" rel="stylesheet" type="text/css" />
    <script src="<%=path%>/dwr/engine.js"></script>
    <script src="<%=path%>/dwr/util.js"></script>
    <script src="<%=path%>/dwr/interface/shiyueDwr.js"></script>
      <script type="text/javascript" src="<%=path %>/js/syAjax.js"></script>
  <script type="text/javascript" src="<%=path %>/js/json2.js"></script>
	<script type="text/javascript">
		window.onload = function(){	
	      shiyueDwr.findCodeByCodeMaintenanceTypeId("XXBBM",getXXBBMCallBack);
		  shiyueDwr.findCodeByCodeMaintenanceTypeId("SZDJJSXM",getSZDJJSXMCallBack);
		  shiyueDwr.findCodeByCodeMaintenanceTypeId("SZDMZSX",getSZDMZSXCallBack);
		  shiyueDwr.findCodeByCodeMaintenanceTypeId("ZJXYYM",getZJXYYMCallBack);
		  shiyueDwr.findCodeByCodeMaintenanceTypeId("ZJXYYM",getFJXYYMCallBack);
      	  if(parent!=null)parent.resizeIframe();
      }
      
      function checkForm()
      {
	     var u_headOfUnit = document.getElementById('u_headOfUnit').value;
	     var u_address = document.getElementById('u_address').value;
	     var u_zipCode = document.getElementById('u_zipCode').value;
	     var u_phone = document.getElementById('u_phone').value;
	     var u_fax = document.getElementById('u_fax').value;
	     var u_webSite = document.getElementById('u_webSite').value;
	     var u_email = document.getElementById('u_email').value;
	     if(u_headOfUnit.length>25){
	     	alert('学校负责人字数过长');
	     	return false;
	     }
	     
	     if(u_address.length>50){
	     	alert('地址字数过长');
	     	return false;
	     }
	     
	     if(u_zipCode.length>10){
	     	alert("邮编字数过长");
	     	return false;
	     }
	     
	     if(u_phone.length>13){
	     	alert("电话字数过长");
	     	return false;
	     }
	     
	     if(u_fax.length>13){
	     	alert("传真字数过长");
	     	return false;
	     }
	     
	     if(u_webSite.length>15){
	     	alert("网址字数过长");
	     	return false;
	     }
	      if(u_email.length>50){
	     	alert("邮箱字数过长");
	     	return false;
	     }
	     
	     return true;
      }
    function getSZDMZSXCallBack(map)
    {
       DWRUtil.addOptions("SZDMZSXselect", map);
       document.getElementById("SZDMZSXselect").value="${requestScope.unit.SZDMZSX}";
    }
	 function getFJXYYMCallBack(map)
    {
       DWRUtil.addOptions("FJXYYMselect", map);
       document.getElementById("FJXYYMselect").value="${requestScope.unit.FJXYYM}";
    }
	 function getZJXYYMCallBack(map)
    {
       DWRUtil.addOptions("ZJXYYMselect", map);
       document.getElementById("ZJXYYMselect").value="${requestScope.unit.ZJXYYM}";
    }
	 function getSZDJJSXMCallBack(map)
    {
       DWRUtil.addOptions("SZDJJSXMselect", map);
        document.getElementById("SZDJJSXMselect").value="${requestScope.unit.SZDJJSXM}";
    }
     function getXXBBMCallBack(map)
    {
       DWRUtil.addOptions("XXBBMselect", map);
        document.getElementById("XXBBMselect").value="${requestScope.unit.XXBBM}";
    }
	</script>
	
	
	<script type="text/javascript">
  		/**上传图片修改  2012-7-16*/
  			var firendId='${requestScope.unit.unitId}';
			var fileType='205';/**办公 单位登录logo  205*/
			var DIVID='';
			var chooseDivId="";
			function displayDiv(id,divId){
			chooseDivId=divId;
					    //添加验证代码开始         
			    DIVID=id;
			     try{
				var head=document.getElementsByTagName("head")[0];
			    var script = document.createElement("script");
				script.type = "text/javascript";
				script.src = "${applicationScope.currentEnclosureServer.outUrl}/enclosure/testNet.action?query=Madonna&output=json&callback=ws_results&t="+new Date();
				head.appendChild(script);
			    }catch(e){
			      alert("附件服务器不通，请联系管理员进行设置");
			    }
		
			    document.getElementById('uploadDIV'+DIVID).style.display='';
			    //添加验证代码结束
		
		    }
			function ws_results(data){
	if(data.result=='true'){
	 if(DIVID==1)
				    {
					    	document.getElementById('upload_hidden_frame'+DIVID).src='<%=path%>/enclosure.jsp';
				    }
					else
					{
			      		/*修改编辑器 focus
			      		document.editframe.eWebEditor.focus();
			      		*/
						document.getElementById('upload_hidden_frame'+DIVID).src='<%=path%>/img.jsp';
					}
		   
	}else{
	 alert('附件服务器不通，请联系管理员进行设置');
	}
	}   
		      	//关闭div
	function closeFTPDIV(id){
		document.getElementById("uploadDIV"+id).style.display = "none";
		syAjax.request("post","<%=path%>/findArticleCommonEnclosureFileAjaxBbsAction.action?fileType=205&isImg=1&firendId=${requestScope.unit.unitId}","",{success:initSuccessResult2,fail:onFail,type:'plain'});
		
	}
	
    //修改编辑器图片
    var imgUrl=null;
    function initSuccessResult2(response)
    {
      
      var data = JSON.parse(response);
      for(var i=0;i<data.length;i++)
      {
	      if(data[i]!=""&&imgUrl!=data[data.length-1].path)
	      {	      	
	      	imgUrl=data[data.length-1].path;
      		document.getElementById(chooseDivId).src="${applicationScope.currentEnclosureServer.outUrl }/enclosure/"+data[data.length-1].path;
      		document.getElementById(chooseDivId+"_hidden").value=data[data.length-1].path;
      		break;
       	  }
      }
    }
  </script>
  </head>
  
  <body>
    <table width="100%" border="0" cellspacing="0" cellpadding="0">
  <tr>
    <td colspan="2" align="left" class="f_5">&nbsp;学校信息设置</td>
  </tr>
  <tr>
    <td height="1" colspan="2" bgcolor="#9DD12E"></td>
  </tr>
  <tr>
    <td colspan="2" align="left" valign="top" bgcolor="#F3F8FC">
   <form action="<%=path %>/updateUnitAction.action" method="post" enctype="multipart/form-data" onsubmit="return checkForm();">
    <table width="100%" border="0" cellspacing="0" cellpadding="0">
    <tr>
         <td >
         <table width="100%">
    <c:if test="${unit.overheadUnit ne '0'}">
      
      </c:if>
      <tr>
        <td width="130" height="28" align="right" valign="bottom" class="f_6">&nbsp;学校编号：</td>
        <td align="left" valign="bottom" class="f_6">${unit.code }<input type="hidden" value="${unit.unitId }" name="unitInfo.unitId" /></td>
      </tr>
      <tr>
        <td height="28" align="right" valign="bottom" class="f_6">&nbsp;学校名称：</td>
        <td align="left" valign="bottom" class="f_6">
          <input type="hidden" name="unitInfo.name" value="${unit.name }" />${unit.name }
        </td>
      </tr>
      <tr>
        <td height="28" align="right" valign="bottom" class="f_6">&nbsp;学校负责人：</td>
        <td align="left" valign="bottom" class="f_6"><input id="u_headOfUnit" type="text" name="unitInfo.headOfUnit" value="${unit.headOfUnit }" /></td>
      </tr>
      <tr>
        <td height="28" align="right" valign="bottom" class="f_6">&nbsp;地址：</td>
        <td align="left" valign="bottom" class="f_6"><input type="text" id="u_address" name="unitInfo.address" value="${unit.address }" /></td>
      </tr>
      <tr>
        <td height="28" align="right" valign="bottom" class="f_6">&nbsp;邮编：</td>
        <td align="left" valign="bottom" class="f_6"><input type="text" id="u_zipCode" name="unitInfo.zipCode" value="${unit.zipCode }" /></td>
      </tr>
      <tr>
        <td height="28" align="right" valign="bottom" class="f_6">&nbsp;电话：</td>
        <td align="left" valign="bottom" class="f_6"><input type="text" id="u_phone" name="unitInfo.phone" value="${unit.phone }" /></td>
      </tr>
      <tr>
        <td height="28" align="right" valign="bottom" class="f_6">&nbsp;传真：</td>
        <td align="left" valign="bottom" class="f_6"><input type="text" id="u_fax" name="unitInfo.fax" value="${unit.fax }" /></td>
      </tr>
      <tr>
        <td height="28" align="right" valign="bottom" class="f_6">&nbsp;网址：</td>
        <td align="left" valign="bottom" class="f_6"><input type="text" id="u_webSite" name="unitInfo.webSite" value="${unit.webSite }" /></td>
      </tr>
      <tr>
        <td height="28" align="right" valign="bottom" class="f_6">&nbsp;邮箱：</td>
        <td align="left" valign="bottom" class="f_6">
          <input type="text" name="unitInfo.email" id="u_email" value="${unit.email }" />
          <input type="hidden" name="unitInfo.overheadUnit" value="${unit.overheadUnit }" />
          <input type="hidden" name="unitInfo.sort" value="${unit.sort }" />
          <input type="hidden" name="unitInfo.registerTime" value="${unit.registerTime }" />
          <input type="hidden" name="unitInfo.code" value="${unit.code }" />
        </td>
      </tr>
      <tr>
        <td height="28" align="right" valign="bottom">&nbsp;登录Logo：</td>
        <td align="left" valign="bottom" class="f_6">
                    
                            <img src="${applicationScope.currentEnclosureServer.outUrl }/enclosure/${requestScope.unit.img}" id="unitLogo" width="473" height="210" align="top" />
          
          <a href="javascript:displayDiv('2','unitLogo');">上传登录Logo</a>
          <input id="unitLogo_hidden" type="hidden" name="unitInfo.img" value="${requestScope.unit.img}"/>
          <span style="color:red;margin-left:20px;">请上传jpg或gif格式，建议图片比例：470×210。</span>
        </td>
      </tr>
       <tr>
        <td height="28" align="right" valign="bottom">&nbsp;页眉图片：</td>
        <td align="left" valign="bottom" class="f_6">
            
                            <img src="${applicationScope.currentEnclosureServer.outUrl }/enclosure/${requestScope.unit.imgYeMei}" id="unitLogo01" width="184" height="94" align="top" />
         
          <a href="javascript:displayDiv('2','unitLogo01');">上传页眉图片</a>
          <input id="unitLogo01_hidden" type="hidden" name="unitInfo.imgYeMei" value="${requestScope.unit.imgYeMei}"/>
          <span style="color:red;margin-left:20px;">请上传jpg或gif格式，建议图片比例：184×95。</span>
        </td>
      </tr>
      </table></td></tr>
      
       <tr>
         <td >
         <table width="100%">
      <tr><td width="130" height="28" align="right" valign="bottom" class="f_6">党组织负责人：</td><td align="left" valign="bottom" class="f_6">
        				<input type="text" name="unitInfo.DZZFZR" value="${unit.DZZFZR }" />&nbsp;
        		</td></tr>
        		<tr><td width="130" height="28" align="right" valign="bottom" class="f_6">建校年月：</td><td align="left" valign="bottom" class="f_6">
        				<input type="text" name="unitInfo.JXNY" value="${unit.JXNY }" />&nbsp;
        		</td></tr>
        		<tr><td width="130" height="28" align="right" valign="bottom" class="f_6">校庆日：</td><td align="left" valign="bottom" class="f_6">
        				<input type="text" name="unitInfo.XQR" value="${unit.XQR }" />&nbsp;
        		</td></tr>
        		<tr id="XXBBM">
	        <td width="130" height="28" align="right" valign="bottom" class="f_6">学校办别：</td>
	        <td align="left" valign="bottom" class="f_6">
	        <select id="XXBBMselect" name="unitInfo.XXBBM">
	        <option></option>
	        </select>
	        </td>
	       
      </tr>

      <tr id="SZDJJSXM">
	        <td width="130" height="28" align="right" valign="bottom" class="f_6">所在地经济属性：</td>
	        <td align="left" valign="bottom" class="f_6">
	        <select id="SZDJJSXMselect" name="unitInfo.SZDJJSXM">
	        <option></option>
	        </select>
	        </td>
      </tr>
      <tr id="SZDMZSX">
	        <td width="130" height="28" align="right" valign="bottom" class="f_6">所在地民族属性：</td>
	        <td align="left" valign="bottom" class="f_6">
	        <select id="SZDMZSXselect" name="unitInfo.SZDMZSX">
	        <option></option>
	        </select>
	        </td>
      </tr>
       <tr id="XXGDXZ">
	        <td width="130" height="28" align="right" valign="bottom" class="f_6">小学规定学制：</td>
	       <td align="left" valign="bottom" class="f_6">
	       <input type="text" name="unitInfo.XXGDXZ" value="${unit.XXGDXZ }" />&nbsp;
	        </td>
      </tr>
       <tr id="XXRXNL">
	       <td width="130" height="28" align="right" valign="bottom" class="f_6">小学入学年龄：</td>
	       <td align="left" valign="bottom" class="f_6">
	       <input type="text" name="unitInfo.XXRXNL" value="${unit.XXRXNL }" />&nbsp;
	        </td>
      </tr>
      <tr id="CZGDXZ">
	        <td width="130" height="28" align="right" valign="bottom" class="f_6">初中规定学制：</td>
	        <td align="left" valign="bottom" class="f_6">
	       <input type="text" name="unitInfo.CZGDXZ" value="${unit.CZGDXZ }" />&nbsp;
	        </td>
      </tr>
      <tr id="CZRXNL">
	        <td width="130" height="28" align="right" valign="bottom" class="f_6">初中入学年龄：</td>
	        <td align="left" valign="bottom" class="f_6">
	       <input type="text" name="unitInfo.CZRXNL" value="${unit.CZRXNL }" />&nbsp;
	        </td>
      </tr>
      <tr id="GZGDXZ">
	        <td width="130" height="28" align="right" valign="bottom" class="f_6">高中规定学制：</td>
	       <td align="left" valign="bottom" class="f_6">
	       <input type="text" name="unitInfo.GZGDXZ" value="${unit.GZGDXZ }" />&nbsp;
	        </td>
      </tr>
      <tr id="ZJXYYM">
	       <td width="130" height="28" align="right" valign="bottom" class="f_6">主教学语言：</td>
	       <td align="left" valign="bottom" class="f_6">
	       <select id="ZJXYYMselect" name="unitInfo.ZJXYYM">
	       <option></option>
	        </select></td>
      </tr>
      <tr id="FJXYYM">
	       <td width="130" height="28" align="right" valign="bottom" class="f_6">辅教学语言：</td>
	        <td align="left" valign="bottom" class="f_6">
	       <select id="FJXYYMselect" name="unitInfo.FJXYYM">
	       <option></option>
	        </select>
	        </td>
      </tr>
      <tr id="ZSQY">
	       <td width="130" height="28" align="right" valign="bottom" class="f_6">招生区域：</td>
	        <td align="left" valign="bottom" class="f_6">
	      <input type="text" name="unitInfo.ZSQY" value="${unit.ZSQY}" />&nbsp;
	        </td>
      </tr>
       <tr id="ZZJGDM">
	        <td width="130" height="28" align="right" valign="bottom" class="f_6">组织机构：</td>
	      <td align="left" valign="bottom" class="f_6">
	      <input type="text" name="unitInfo.ZZJGDM" value="${unit.ZZJGDM}" />&nbsp;
	        </td>
      </tr></table></td></tr>
      <!-- <tr>
        <td height="28" align="right" valign="bottom" class="f_6">是否贫困：</td>
        <td align="left" valign="bottom" class="f_6"><input type="radio" name="radiobutton" value="radiobutton" />          是
          <input type="radio" name="radiobutton" value="radiobutton" />
          否</td>
      </tr> -->
      <tr>
            <td height="1" colspan="2" bgcolor="#ACA899"></td>
      </tr>
      <tr>
        <td height="28" colspan="2" align="center" valign="bottom" class="f_6"><input type="submit" name="Submit2" value="提 交" /></td>
      </tr>
    </table>
		</form>
	</td>
  </tr>
  <tr>
    <td colspan="2" align="left" bgcolor="#F3F8FC">&nbsp;</td>
  </tr>
</table>
<!-- 上传图片新添加的div -->
<div style="position:absolute;left:350px; top:250px;width:350px;height:140px;background-color:#F1F5F8;border:1px solid lightblue; display: none" id='uploadDIV2'>
		<div style="width:100%;top:50px;left:200px; background-color:#89B5E9;" id="title" align="right">
            <table width="100%" border="0" cellpadding="0" cellspacing="0" height="25" bgcolor="#89B5E9" class="f_16"><tr><td align="left">&nbsp;插入图片</td><td align="right"><a href="javascript:closeFTPDIV('2');" style="text-decoration: none;"><span style="color: red; font-size:;">[关闭]</span></a>&nbsp;</td></tr></table>
     	</div>
		<iframe name="upload_hidden_frame2" id="upload_hidden_frame2"  src="<%=path%>/enclosure.jsp" style="width:100%;height:140px;" align="middle" scrolling="no" frameborder="0"></iframe>   
		</div>
  </body>
</html>
